package com.zhonghan.recharge.task;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.zhonghan.common.wechat.api.TokenApi;
import com.zhonghan.common.wechat.bean.token.Token;

/**
 * 定时获取微信access_token
 * @author zhangceven
 *
 */
@Component
public class WechatAccessTokenTask {
	
	private Logger logger = Logger.getLogger(this.getClass());

	@Value("${wechat.APPID}")
	private String APPID;
	
	@Value("${wechat.APPSECRET}")
	private String APPSECRET;
	
	public void getAccessToken(){
		
		Token token = TokenApi.getToken(APPID, APPSECRET);
		
		String access_token = token.getAccess_token();
		
		TaskList.Wechat_Access_Token = access_token;
		
		logger.info("获取微信接口调用凭证: " + access_token);
		
	}
	
	
}
